package com.web.graduationpro.controller;

import java.io.UnsupportedEncodingException;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.web.graduationpro.dao.service.ApplyService;
import com.web.graduationpro.dao.service.ArticleService;
import com.web.graduationpro.dao.service.ArticleTypeService;
import com.web.graduationpro.dao.service.GoodsService;
import com.web.graduationpro.dao.service.InstrumentSchoolService;
import com.web.graduationpro.model.InstrumentSchool;
import com.web.graduationpro.model.InstrumentCourse;
import com.web.graduationpro.model.Apply;
import com.web.graduationpro.model.Goods;
import com.web.graduationpro.model.ArticleType;

@Controller
public class IndexController {
	
	private static Logger logger = LoggerFactory.getLogger(IndexController.class);
	
	@RequestMapping(value = "/index", method = RequestMethod.GET)  
    public String index(HttpServletRequest request,HttpServletResponse reponse) {  
		try {
			request.setCharacterEncoding("UTF-8");
		} catch (UnsupportedEncodingException e1) {
			e1.printStackTrace();
		}
		reponse.setContentType("text/html;charset=UTF-8");
		
		/*
		List<InstrumentSchool> doctors = doctorServiceImpl.findByPage(" FROM Doctor ", 0, 3);
		if(doctors!=null && doctors.size()!=0){
			request.setAttribute("doctors", doctors);
		}*/

		
        return "/index";
    }  
	
	@RequestMapping(value = "/goregister", method = RequestMethod.GET)  
    public String goregister() {  
        return "/user/register";
    } 
	
	@RequestMapping(value = "/gologin", method = RequestMethod.GET)  
    public String gologin() {  
        return "/user/login";
    }  
	
	@RequestMapping(value = "/logout", method = RequestMethod.GET)  
    public String logout(HttpServletRequest request) {  
		request.getSession().removeAttribute("loginedUser");
		request.getSession().removeAttribute("logUserId");
		return "/user/login";
    }  
}
